﻿using FastServer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Net.Mime;

// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace Server.Web.Controllers
{
    /// <summary>
    /// Swagger文档示例控制器
    /// </summary>
    /// <response code="200">成功</response> 
    /// <response code="default">成功默认返回值示例</response> 
    [Route("api/[controller]")]
    [ApiController]
    [ApiDescriptionSettings(Tag = "Swagger文档示例接口", Groups = new []{ "Swagger文档示例接口@1" })]
    [Consumes(MediaTypeNames.Application.Json, new string[] { MediaTypeNames.Text.Plain })]
    [Produces(MediaTypeNames.Application.Json, new string[] { MediaTypeNames.Text.Plain })]
    [AllowAnonymous]
    public class SwaggerDocumentExampleController : ControllerBase
    {
        // GET: api/<SwaggerDocumentExampleController>
        /// <summary>
        /// 获取一个数组
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IEnumerable<string> Get()
        {
            return new string[] { "value1", "value2" };
        }

        // GET api/<SwaggerDocumentExampleController>/5
        /// <summary>
        /// 传入一个Id获取值
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet("{id}")]
        public string Get(int id)
        {
            return "value";
        }

        /// <summary>
        /// POST
        /// </summary>
        /// <param name="value"></param>
        // POST api/<SwaggerDocumentExampleController>
        [HttpPost]
        public void Post([FromBody] string value)
        {
        }

        // PUT api/<SwaggerDocumentExampleController>/5
        [HttpPut("{id}")]
        public void Put(int id, [FromBody] string value)
        {
        }

        // DELETE api/<SwaggerDocumentExampleController>/5
        [HttpDelete("{id}")]
        public void Delete(int id)
        {
        }
    }
}
